/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package units;

/**
 *
 * @author jamie
 */
public class Expression implements Comparable {

    private Sample sample;
    private Gene gene;
    private int timePoint;
    private double logExp;
    private double pValue;
    private int probeId;

    public Expression(int probeId) {
        this.probeId = probeId;
    }

    public int getProbeId() {
        return probeId;
    }

    

    @Override
    public boolean equals(Object other) {
        if (other.getClass().equals(Expression.class)) {
            Expression otherDE = (Expression) other;
            if (otherDE.getSample().equals(this.getSample()) && otherDE.getTimePoint() == this.getTimePoint() && otherDE.getGene().equals(this.getGene())) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + (this.sample != null ? this.sample.hashCode() : 0);
        hash = 37 * hash + (this.gene != null ? this.gene.hashCode() : 0);
        hash = 37 * hash + this.timePoint;
        return hash;
    }

    public Gene getGene() {
        return gene;
    }

    public void setGene(Gene gene) {
        this.gene = gene;
    }

    public double getLogExp() {
        return logExp;
    }

    public void setLogExp(double logExp) {
        this.logExp = logExp;
    }

    public double getpValue() {
        return pValue;
    }

    public void setpValue(double pValue) {
        this.pValue = pValue;
    }

    public Sample getSample() {
        return sample;
    }

    public void setSample(Sample sample) {
        this.sample = sample;
    }

    public int getTimePoint() {
        return timePoint;
    }

    public void setTimePoint(int timePoint) {
        this.timePoint = timePoint;
    }

    public int compareTo(Object o) {
        Expression otherDE = (Expression) o;
        if (otherDE.getSample().equals(otherDE.getSample())) {
            if (this.getTimePoint() == otherDE.getTimePoint()) {
                return this.getGene().compareTo(otherDE.getGene());
            } else {
                return new Integer(this.getTimePoint()).compareTo(new Integer(otherDE.getTimePoint()));
            }
        } else {
            return this.getSample().compareTo(otherDE.getSample());
        }
    }
}
